All Packages Class Hierarchy This Package Previous Next Index
Class sun.servlet.http.HttpServer
java.lang.Object
|
+----sun.servlet.http.HttpServer
- public class HttpServer
- extends Object
- implements Runnable, ServletContext
This class implements a simple HTTP server for testing servlets.
-
avail
- The number of available handlers.
-
backlog
- The backlog parameter to use when creating the server socket.
-
connections
- The queue of pending connections.
-
documentDir
- The document root directory for serving files.
-
handlers
- The thread group for connection handlers.
-
host
- The host name of the server.
-
loader
- The servlet loader.
-
maxHandlers
- The maximum number of handler threads.
-
name
- The name of the server.
-
port
- The server port number.
-
servletDir
- The directory where servlets are stored.
-
servletPropFile
- The filename which contains servlet properties
-
servletProps
- The properties list that decribes servlet aliases and init args
-
timeout
- The handler timeout in milliseconds.
-
total
- The total number of active handlers.
-
verbose
- Set to true for verbose output.
-
HttpServer()
- Creates a new HTTP server with default parameters.
-
HttpServer(Properties)
- Creates a new HTTP server with parameters from the specified properties.
-
getAttribute(String)
- Returns an attribute of the server for the specified key name.
-
getConnection()
- Called by a connection handler to retrieve the next connection from
the queue.
-
getHostName()
- Returns the host name of the server.
-
getIntProperty(Properties, String, int)
- Returns the integer value of a property.
-
getMimeType(String)
- Returns the mime type of the specified file.
-
getRealPath(String)
- Returns the translated path for the specified virtual path.
-
getServerInfo()
- Returns the name and version of the current server.
-
getServlet(String)
- Gets a servlet by name.
-
getServlets()
- Enumerates the servlets in this server.
-
help()
-
-
loadProperties(Properties)
- Loads parameters from the specified properties.
-
log(String)
- Writes a message to the servlet log.
-
main(String[])
- Runs the HTTP server.
-
printSettings()
-
-
putConnection(Object)
- Places the specified connection object on the queue of pending
connections.
-
run()
- Runs the servlet server.
connections
protected Queue connections
- The queue of pending connections.
handlers
protected ThreadGroup handlers
- The thread group for connection handlers.
maxHandlers
protected int maxHandlers
- The maximum number of handler threads.
timeout
protected int timeout
- The handler timeout in milliseconds.
port
protected int port
- The server port number.
backlog
protected int backlog
- The backlog parameter to use when creating the server socket.
avail
protected int avail
- The number of available handlers.
total
protected int total
- The total number of active handlers.
name
protected String name
- The name of the server.
host
protected String host
- The host name of the server.
servletDir
protected String servletDir
- The directory where servlets are stored.
servletProps
protected Properties servletProps
- The properties list that decribes servlet aliases and init args
servletPropFile
protected String servletPropFile
- The filename which contains servlet properties
documentDir
protected String documentDir
- The document root directory for serving files.
loader
protected ServletLoader loader
- The servlet loader.
verbose
protected boolean verbose
- Set to true for verbose output.
HttpServer
public HttpServer()
- Creates a new HTTP server with default parameters.
HttpServer
public HttpServer(Properties props)
- Creates a new HTTP server with parameters from the specified properties.
- Parameters:
- props - the server properties
loadProperties
public void loadProperties(Properties props)
- Loads parameters from the specified properties.
- Parameters:
- props - the server properties
getIntProperty
protected static int getIntProperty(Properties prop,
String name,
int def)
- Returns the integer value of a property.
getHostName
protected static String getHostName()
- Returns the host name of the server.
run
public void run()
- Runs the servlet server.
putConnection
protected void putConnection(Object s)
- Places the specified connection object on the queue of pending
connections.
getConnection
public Object getConnection()
- Called by a connection handler to retrieve the next connection from
the queue. If this method returns null then the handler should
exit as the thread has expired.
getServlet
public Servlet getServlet(String name)
- Gets a servlet by name.
getServlets
public Enumeration getServlets()
- Enumerates the servlets in this server.
log
public void log(String msg)
- Writes a message to the servlet log.
getMimeType
public String getMimeType(String name)
- Returns the mime type of the specified file.
getRealPath
public String getRealPath(String path)
- Returns the translated path for the specified virtual path.
getServerInfo
public String getServerInfo()
- Returns the name and version of the current server.
getAttribute
public Object getAttribute(String name)
- Returns an attribute of the server for the specified key name.
- Parameters:
- name - the attribute name
- Returns:
- the value of the attribute or null if not found
main
public static void main(String args[])
- Runs the HTTP server.
printSettings
protected void printSettings()
help
protected static void help()
All Packages Class Hierarchy This Package Previous Next Index